<template>
  <div class="bg-white rounded-lg p-5 h-full ">
    <div class="font-bold text-xl mb-4">医师详情</div>
    <div class="flex">
      <img class="w-40" :src="doctorInfo.photo" alt="" />
      <div>
        <el-descriptions :column="2" border>
          <el-descriptions-item label="姓名">{{ doctorInfo.physicianName }}</el-descriptions-item>
          <el-descriptions-item label="性别">{{ doctorInfo.sex }}</el-descriptions-item>
          <el-descriptions-item label="身份证号" :span="2"
            >{{ doctorInfo.identityNumber }}</el-descriptions-item
          >
          <el-descriptions-item label="证书编号"> {{ doctorInfo.certificateNumber }} </el-descriptions-item>
          <el-descriptions-item label="签发日期"
            >
            {{ doctorInfo.issueDate }}
            </el-descriptions-item>
          <el-descriptions-item label="是否多点执业">
            {{ doctorInfo.multiPoint }}
          </el-descriptions-item>
          <el-descriptions-item label="医师资格证编码" span="2"
            > {{ doctorInfo.certificateNumber }}</el-descriptions-item
          >
          <el-descriptions-item label="执行类别" span="2">
            {{ doctorInfo.practicingType }}
          </el-descriptions-item>
          <el-descriptions-item label="执业范围" span="2">
           {{ doctorInfo.practicingRange }}
            </el-descriptions-item>
        </el-descriptions>
      </div>
    </div>
    <div class="font-bold text-lg my-4">执行地点</div>
    <el-table :data="executeList" border>
      <el-table-column prop="enterpriseName" label="职业地点名称" align="center">
      </el-table-column>
      <el-table-column prop="addr" align="center" label="地址"> </el-table-column>
      <el-table-column prop="mainStatus" align="center" label="是否主要执行点"> 
        <template #default="scope">
          <dict-tag
            :options="dict.type.yes_or_no"
            :value="scope.row.mainStatus"
          />
        </template>
      </el-table-column>
      <el-table-column prop="recordRegistration" align="center" label="是否多点执业备案注册 ">
        <template #default="scope">
          <dict-tag
            :options="dict.type.yes_or_no"
            :value="scope.row.recordRegistration"
          />
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="eTotal > 0"
      :total="eTotal"
      :page.sync="eQueryParams.pageNum"
      :limit.sync="eQueryParams.pageSize"
      @pagination="getExecuteList"
    />
    <div class="font-bold text-lg my-4">单位变更记录</div>
    <el-table :data="unitChangeList" border>
     
      <el-table-column prop="oldUnitName" align="center" label="变更前单位名称"> </el-table-column>
      <el-table-column prop="nowUnitName" align="center" label="变更后单位名称"> </el-table-column>
      <el-table-column prop="changeDate" align="center" label="变更日期"> </el-table-column>
    </el-table>
    <pagination
     class="mb-4"
      v-show="uTotal > 0"
      :total="uTotal"
      :page.sync="uQueryParams.pageNum"
      :limit.sync="uQueryParams.pageSize"
      @pagination="getUnitChangeList"
    />
    <!-- <hr class="my-4"> -->
    <div>
        <el-button type="primary" @click="goBack">返回</el-button>
    </div>
  </div>
</template>

<script>
import {getDoctorDetailAPI,getDoctorExecutePlaceAPI,getUnitChangeRecordAPI} from '@/api/zhangping/health-care/base-info.js'
export default {
  dicts:['yes_or_no'],
  mixins: [],
  components: {},
  props: {},
  data() {
    return {
      eQueryParams:{
        page:1,
        pageSize:10,
        physicianId:this.$route.query.id, 
      },
      uQueryParams:{
        page:1,
        pageSize:10,
        physicianId:this.$route.query.id, 
      },
      eTotal:0,
      uTotal:0,
      doctorInfo:{},
      executeList:[],
      unitChangeList:[],
      dataList:[]
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {
    this.getInfo();
    this.getExecuteList()
    this.getUnitChangeList()
  },
  methods: {
    getExecuteList(){
     
      getDoctorExecutePlaceAPI(this.eQueryParams).then(res=>{
        const {rows,code,total} =res
        if(code===200){
          this.eTotal = total  
          this.executeList = rows
        }
      })
    },
    getUnitChangeList(){
     
      getUnitChangeRecordAPI(this.uQueryParams).then(res=>{
        const {rows,code,total} =res
        if(code===200){
          this.uTotal = total 
          this.unitChangeList = rows 
        }
      }) 
    },
    getInfo(){
      const params = {
        id:this.$route.query.id
      }
      getDoctorDetailAPI(params).then(res=>{
        const {data,code} =res 
        if(code===200){
          this.doctorInfo = data  
        }
      })
    },
    goBack() {
      this.$router.back(); 
    },

  },
};
</script>

<style scoped lang="scss"></style>
